home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / man.3 / TraceVar.3 < prev    next >
Text File  |  1995-07-17  |  19KB  |  543 lines

  1. '\"
  2. '\" Copyright (c) 1989-1993 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/tcl/man/RCS/TraceVar.3,v 1.14 93/05/03 15:53:18 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .\" The definitions below are for supplemental macros used in Tcl/Tk
  24. .\" manual entries.
  25. .\"
  26. .\" .HS name section [date [version]]
  27. .\"    Replacement for .TH in other man pages.  See below for valid
  28. .\"    section names.
  29. .\"
  30. .\" .AP type name in/out [indent]
  31. .\"    Start paragraph describing an argument to a library procedure.
  32. .\"    type is type of argument (int, etc.), in/out is either "in", "out",
  33. .\"    or "in/out" to describe whether procedure reads or modifies arg,
  34. .\"    and indent is equivalent to second arg of .IP (shouldn't ever be
  35. .\"    needed;  use .AS below instead)
  36. .\"
  37. .\" .AS [type [name]]
  38. .\"    Give maximum sizes of arguments for setting tab stops.  Type and
  39. .\"    name are examples of largest possible arguments that will be passed
  40. .\"    to .AP later.  If args are omitted, default tab stops are used.
  41. .\"
  42. .\" .BS
  43. .\"    Start box enclosure.  From here until next .BE, everything will be
  44. .\"    enclosed in one large box.
  45. .\"
  46. .\" .BE
  47. .\"    End of box enclosure.
  48. .\"
  49. .\" .VS
  50. .\"    Begin vertical sidebar, for use in marking newly-changed parts
  51. .\"    of man pages.
  52. .\"
  53. .\" .VE
  54. .\"    End of vertical sidebar.
  55. .\"
  56. .\" .DS
  57. .\"    Begin an indented unfilled display.
  58. .\"
  59. .\" .DE
  60. .\"    End of indented unfilled display.
  61. .\"
  62. '\"    # Heading for Tcl/Tk man pages
  63. .de HS
  64. .ds ^3 \\0
  65. .if !"\\$3"" .ds ^3 \\$3
  66. .if '\\$2'cmds'       .TH \\$1 1 \\*(^3 \\$4
  67. .if '\\$2'lib'        .TH \\$1 3 \\*(^3 \\$4
  68. .if '\\$2'tcl'        .TH \\$1 n \\*(^3 Tcl "Tcl Built-In Commands"
  69. .if '\\$2'tk'         .TH \\$1 n \\*(^3 Tk "Tk Commands"
  70. .if '\\$2'tclc'        .TH \\$1 3 \\*(^3 Tcl "Tcl Library Procedures"
  71. .if '\\$2'tkc'         .TH \\$1 3 \\*(^3 Tk "Tk Library Procedures"
  72. .if '\\$2'tclcmds'         .TH \\$1 1 \\*(^3 Tk "Tcl Applications"
  73. .if '\\$2'tkcmds'         .TH \\$1 1 \\*(^3 Tk "Tk Applications"
  74. .if t .wh -1.3i ^B
  75. .nr ^l \\n(.l
  76. .ad b
  77. ..
  78. '\"    # Start an argument description
  79. .de AP
  80. .ie !"\\$4"" .TP \\$4
  81. .el \{\
  82. .   ie !"\\$2"" .TP \\n()Cu
  83. .   el          .TP 15
  84. .\}
  85. .ie !"\\$3"" \{\
  86. .ta \\n()Au \\n()Bu
  87. \&\\$1    \\fI\\$2\\fP    (\\$3)
  88. .\".b
  89. .\}
  90. .el \{\
  91. .br
  92. .ie !"\\$2"" \{\
  93. \&\\$1    \\fI\\$2\\fP
  94. .\}
  95. .el \{\
  96. \&\\fI\\$1\\fP
  97. .\}
  98. .\}
  99. ..
  100. '\"    # define tabbing values for .AP
  101. .de AS
  102. .nr )A 10n
  103. .if !"\\$1"" .nr )A \\w'\\$1'u+3n
  104. .nr )B \\n()Au+15n
  105. .\"
  106. .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
  107. .nr )C \\n()Bu+\\w'(in/out)'u+2n
  108. ..
  109. '\"    # BS - start boxed text
  110. '\"    # ^y = starting y location
  111. '\"    # ^b = 1
  112. .de BS
  113. .br
  114. .mk ^y
  115. .nr ^b 1u
  116. .if n .nf
  117. .if n .ti 0
  118. .if n \l'\\n(.lu\(ul'
  119. .if n .fi
  120. ..
  121. '\"    # BE - end boxed text (draw box now)
  122. .de BE
  123. .nf
  124. .ti 0
  125. .mk ^t
  126. .ie n \l'\\n(^lu\(ul'
  127. .el \{\
  128. .\"    Draw four-sided box normally, but don't draw top of
  129. .\"    box if the box started on an earlier page.
  130. .ie !\\n(^b-1 \{\
  131. \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  132. .\}
  133. .el \}\
  134. \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
  135. .\}
  136. .\}
  137. .fi
  138. .br
  139. .nr ^b 0
  140. ..
  141. '\"    # VS - start vertical sidebar
  142. '\"    # ^Y = starting y location
  143. '\"    # ^v = 1 (for troff;  for nroff this doesn't matter)
  144. .de VS
  145. .mk ^Y
  146. .ie n 'mc \s12\(br\s0
  147. .el .nr ^v 1u
  148. ..
  149. '\"    # VE - end of vertical sidebar
  150. .de VE
  151. .ie n 'mc
  152. .el \{\
  153. .ev 2
  154. .nf
  155. .ti 0
  156. .mk ^t
  157. \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
  158. .sp -1
  159. .fi
  160. .ev
  161. .\}
  162. .nr ^v 0
  163. ..
  164. '\"    # Special macro to handle page bottom:  finish off current
  165. '\"    # box/sidebar if in box/sidebar mode, then invoked standard
  166. '\"    # page bottom macro.
  167. .de ^B
  168. .ev 2
  169. 'ti 0
  170. 'nf
  171. .mk ^t
  172. .if \\n(^b \{\
  173. .\"    Draw three-sided box if this is the box's first page,
  174. .\"    draw two sides but no top otherwise.
  175. .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  176. .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
  177. .\}
  178. .if \\n(^v \{\
  179. .nr ^x \\n(^tu+1v-\\n(^Yu
  180. \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
  181. .\}
  182. .bp
  183. 'fi
  184. .ev
  185. .if \\n(^b \{\
  186. .mk ^y
  187. .nr ^b 2
  188. .\}
  189. .if \\n(^v \{\
  190. .mk ^Y
  191. .\}
  192. ..
  193. '\"    # DS - begin display
  194. .de DS
  195. .RS
  196. .nf
  197. .sp
  198. ..
  199. '\"    # DE - end display
  200. .de DE
  201. .fi
  202. .RE
  203. .sp .5
  204. ..
  205. .HS Tcl_TraceVar tclc
  206. .BS
  207. .SH NAME
  208. Tcl_TraceVar, Tcl_TraceVar2, Tcl_UntraceVar, Tcl_UntraceVar2, Tcl_VarTraceInfo, Tcl_VarTraceInfo2 \- monitor accesses to a variable
  209. .SH SYNOPSIS
  210. .nf
  211. \fB#include <tcl.h>\fR
  212. .sp
  213. int
  214. \fBTcl_TraceVar(\fIinterp, varName, flags, proc, clientData\fB)\fR
  215. .sp
  216. int
  217. \fBTcl_TraceVar2(\fIinterp, name1, name2, flags, proc, clientData\fB)\fR
  218. .sp
  219. \fBTcl_UntraceVar(\fIinterp, varName, flags, proc, clientData\fB)\fR
  220. .sp
  221. \fBTcl_UntraceVar2(\fIinterp, name1, name2, flags, proc, clientData\fB)\fR
  222. .sp
  223. ClientData
  224. \fBTcl_VarTraceInfo(\fIinterp, varName, flags, proc, prevClientData\fB)\fR
  225. .sp
  226. ClientData
  227. \fBTcl_VarTraceInfo2(\fIinterp, name1, name2, flags, proc, prevClientData\fB)\fR
  228. .SH ARGUMENTS
  229. .AS Tcl_VarTraceProc prevClientData
  230. .AP Tcl_Interp *interp in
  231. Interpreter containing variable.
  232. .AP char *varName in
  233. Name of variable.  May refer to a scalar variable, to
  234. an array variable with no index, or to an array variable
  235. with a parenthesized index.
  236. .AP int flags in
  237. OR-ed combination of the values TCL_TRACE_READS, TCL_TRACE_WRITES, and
  238. TCL_TRACE_UNSETS, and TCL_GLOBAL_ONLY.  Not all flags are used by all
  239. procedures.  See below for more information.
  240. .AP Tcl_VarTraceProc *proc in
  241. Procedure to invoke whenever one of the traced operations occurs.
  242. .AP ClientData clientData in
  243. Arbitrary one-word value to pass to \fIproc\fR.
  244. .AP char *name1 in
  245. Name of scalar or array variable (without array index).
  246. .AP char *name2 in
  247. For a trace on an element of an array, gives the index of the
  248. element.  For traces on scalar variables or on whole arrays,
  249. is NULL.
  250. .AP ClientData prevClientData in
  251. If non-NULL, gives last value returned by \fBTcl_VarTraceInfo\fR or
  252. \fBTcl_VarTraceInfo2\fR, so this call will return information about
  253. next trace.  If NULL, this call will return information about first
  254. trace.
  255. .BE
  256.  
  257. .SH DESCRIPTION
  258. .PP
  259. \fBTcl_TraceVar\fR allows a C procedure to monitor and control
  260. access to a Tcl variable, so that the C procedure is invoked
  261. whenever the variable is read or written or unset.
  262. If the trace is created successfully then \fBTcl_TraceVar\fR returns
  263. TCL_OK.  If an error occurred (e.g. \fIvarName\fR specifies an element
  264. of an array, but the actual variable isn't an array) then TCL_ERROR
  265. is returned and an error message is left in \fIinterp->result\fR.
  266. .PP
  267. The \fIflags\fR argument to \fBTcl_TraceVar\fR indicates when the
  268. trace procedure is to be invoked and provides information
  269. for setting up the trace.  It consists of an OR-ed combination
  270. of any of the following values:
  271. .TP
  272. \fBTCL_GLOBAL_ONLY\fR
  273. Normally, the variable will be looked up at the current level of
  274. procedure call;  if this bit is set then the variable will be looked
  275. up at global level, ignoring any active procedures.
  276. .TP
  277. \fBTCL_TRACE_READS\fR
  278. Invoke \fIproc\fR whenever an attempt is made to read the variable.
  279. .TP
  280. \fBTCL_TRACE_WRITES\fR
  281. Invoke \fIproc\fR whenever an attempt is made to modify the variable.
  282. .TP
  283. \fBTCL_TRACE_UNSETS\fR
  284. Invoke \fIproc\fR whenever the variable is unset.
  285. A variable may be unset either explicitly by an \fBunset\fR command,
  286. or implicitly when a procedure returns (its local variables are
  287. automatically unset) or when the interpreter is deleted (all
  288. variables are automatically unset).
  289. .PP
  290. Whenever one of the specified operations occurs on the variable,
  291. \fIproc\fR will be invoked.
  292. It should have arguments and result that match the type
  293. \fBTcl_VarTraceProc\fR:
  294. .nf
  295. .RS
  296. typedef char *Tcl_VarTraceProc(
  297. .RS
  298. ClientData \fIclientData\fR,
  299. Tcl_Interp *\fIinterp\fR,
  300. char *\fIname1\fR,
  301. char *\fIname2\fR,
  302. int \fIflags\fR);
  303. .RE
  304. .RE
  305. .fi
  306. The \fIclientData\fP and \fIinterp\fP parameters will
  307. have the same values as those passed to \fBTcl_TraceVar\fR when the
  308. trace was created.
  309. \fIClientData\fR typically points to an application-specific
  310. data structure that describes what to do when \fIproc\fR
  311. is invoked.
  312. \fIName1\fR and \fIname2\fR give the name of the traced variable
  313. in the normal two-part form (see the description of \fBTcl_TraceVar2\fR
  314. below for details).
  315. \fIFlags\fR is an OR-ed combination of bits providing several
  316. pieces of information.
  317. One of the bits TCL_TRACE_READS, TCL_TRACE_WRITES, or TCL_TRACE_UNSETS
  318. will be set in \fIflags\fR to indicate which operation is being performed
  319. on the variable.
  320. The bit TCL_GLOBAL_ONLY will be set whenever the variable being
  321. accessed is a global one not accessible from the current level of
  322. procedure call:  the trace procedure will need to pass this flag
  323. back to variable-related procedures like \fBTcl_GetVar\fR if it
  324. attempts to access the variable.
  325. The bit TCL_TRACE_DESTROYED will be set in \fIflags\fR if the trace is
  326. about to be destroyed;  this information may be useful to \fIproc\fR
  327. so that it can clean up its own internal data structures (see
  328. the section TCL_TRACE_DESTROYED below for more details).
  329. Lastly, the bit TCL_INTERP_DESTROYED will be set if the entire
  330. interpreter is being destroyed.
  331. When this bit is set, \fIproc\fR must be especially careful in
  332. the things it does (see the section TCL_INTERP_DESTROYED below).
  333. The trace procedure's return value should normally be NULL;  see
  334. ERROR RETURNS below for information on other possibilities.
  335. .PP
  336. \fBTcl_UntraceVar\fR may be used to remove a trace.
  337. If the variable specified by \fIinterp\fR, \fIvarName\fR, and \fIflags\fR
  338. has a trace set with \fIflags\fR, \fIproc\fR, and
  339. \fIclientData\fR, then the corresponding trace is removed.
  340. If no such trace exists, then the call to \fBTcl_UntraceVar\fR
  341. has no effect.
  342. The same bits are valid for \fIflags\fR as for calls to \fBTcl_TraceVars\fR.
  343. .PP
  344. \fBTcl_VarTraceInfo\fR may be used to retrieve information about
  345. traces set on a given variable.
  346. The return value from \fBTcl_VarTraceInfo\fR is the \fIclientData\fR
  347. associated with a particular trace.
  348. The trace must be on the variable specified by the \fIinterp\fR,
  349. \fIvarName\fR, and \fIflags\fR arguments (only the TCL_GLOBAL_ONLY
  350. bit from \fIflags\fR is used;  other bits are ignored) and its trace procedure
  351. must the same as the \fIproc\fR argument.
  352. If the \fIprevClientData\fR argument is NULL then the return
  353. value corresponds to the first (most recently created) matching
  354. trace, or NULL if there are no matching traces.
  355. If the \fIprevClientData\fR argument isn't NULL, then it should
  356. be the return value from a previous call to \fBTcl_VarTraceInfo\fR.
  357. In this case, the new return value will correspond to the next
  358. matching trace after the one whose \fIclientData\fR matches
  359. \fIprevClientData\fR, or NULL if no trace matches \fIprevClientData\fR
  360. or if there are no more matching traces after it.
  361. This mechanism makes it possible to step through all of the
  362. traces for a given variable that have the same \fIproc\fR.
  363.  
  364. .SH "TWO-PART NAMES"
  365. .PP
  366. The procedures \fBTcl_TraceVar2\fR, \fBTcl_UntraceVar2\fR, and
  367. \fBTcl_VarTraceInfo2\fR are identical to \fBTcl_TraceVar\fR,
  368. \fBTcl_UntraceVar\fR, and \fBTcl_VarTraceInfo\fR, respectively,
  369. except that the name of the variable has already been
  370. separated by the caller into two parts.
  371. \fIName1\fR gives the name of a scalar variable or array,
  372. and \fIname2\fR gives the name of an element within an
  373. array.
  374. If \fIname2\fR is NULL it means that either the variable is
  375. a scalar or the trace is to be set on the entire array rather
  376. than an individual element (see WHOLE-ARRAY TRACES below for
  377. more information).
  378.  
  379. .SH "ACCESSING VARIABLES DURING TRACES"
  380. .PP
  381. During read and write traces, the
  382. trace procedure can read, write, or unset the traced
  383. variable using \fBTcl_GetVar2\fR, \fBTcl_SetVar2\fR, and
  384. other procedures.
  385. While \fIproc\fR is executing, traces are temporarily disabled
  386. for the variable, so that calls to \fBTcl_GetVar2\fR and
  387. \fBTcl_SetVar2\fR will not cause \fIproc\fR or other trace procedures
  388. to be invoked again.
  389. Disabling only occurs for the variable whose trace procedure
  390. is active;  accesses to other variables will still be traced.
  391. .VS
  392. However, if a variable is unset during a read or write trace then unset
  393. traces will be invoked.
  394. .VE
  395. .PP
  396. During unset traces the variable has already been completely
  397. expunged.
  398. It is possible for the trace procedure to read or write the
  399. variable, but this will be a new version of the variable.
  400. Traces are not disabled during unset traces as they are for
  401. read and write traces, but existing traces have been removed
  402. from the variable before any trace procedures are invoked.
  403. If new traces are set by unset trace procedures, these traces
  404. will be invoked on accesses to the variable by the trace
  405. procedures.
  406.  
  407. .SH "CALLBACK TIMING"
  408. .PP
  409. When read tracing has been specified for a variable, the trace
  410. procedure will be invoked whenever the variable's value is
  411. read.  This includes \fBset\fR Tcl commands, \fB$\fR-notation
  412. in Tcl commands, and invocations of the \fBTcl_GetVar\fR
  413. and \fBTcl_GetVar2\fR procedures.
  414. \fIProc\fR is invoked just before the variable's value is
  415. returned.
  416. It may modify the value of the variable to affect what
  417. is returned by the traced access.
  418. .VS
  419. If it unsets the variable then the access will return an error
  420. just as if the variable never existed.
  421. .VE
  422. .PP
  423. When write tracing has been specified for a variable, the
  424. trace procedure will be invoked whenever the variable's value
  425. is modified.  This includes \fBset\fR commands\fR,
  426. commands that modify variables as side effects (such as
  427. \fBcatch\fR and \fBscan\fR), and calls to the \fBTcl_SetVar\fR
  428. and \fBTcl_SetVar2\fR procedures).
  429. \fIProc\fR will be invoked after the variable's value has been
  430. modified, but before the new value of the variable has been
  431. returned.
  432. It may modify the value of the variable to override the change
  433. and to determine the value actually returned by the traced
  434. access.
  435. .VS
  436. If it deletes the variable then the traced access will return
  437. an empty string.
  438. .VE
  439. .PP
  440. When unset tracing has been specified, the trace procedure
  441. will be invoked whenever the variable is destroyed.
  442. The traces will be called after the variable has been
  443. completely unset.
  444.  
  445. .SH "WHOLE-ARRAY TRACES"
  446. .PP
  447. If a call to \fBTcl_TraceVar\fR or \fBTcl_TraceVar2\fR specifies
  448. the name of an array variable without an index into the array,
  449. then the trace will be set on the array as a whole.
  450. This means that \fIproc\fR will be invoked whenever any
  451. element of the array is accessed in the ways specified by
  452. \fIflags\fR.
  453. When an array is unset, a whole-array trace will be invoked
  454. just once, with \fIname1\fR equal to the name of the array
  455. and \fIname2\fR NULL;  it will not be invoked once for each
  456. element.
  457.  
  458. .SH "MULTIPLE TRACES"
  459. .PP
  460. It is possible for multiple traces to exist on the same variable.
  461. When this happens, all of the trace procedures will be invoked on each
  462. access, in order from most-recently-created to least-recently-created.
  463. When there exist whole-array traces for an array as well as
  464. traces on individual elements, the whole-array traces are invoked
  465. before the individual-element traces.
  466. .VS
  467. If a read or write trace unsets the variable then all of the unset
  468. traces will be invoked but the remainder of the read and write traces
  469. will be skipped.
  470. .VE
  471.  
  472. .SH "ERROR RETURNS"
  473. .PP
  474. Under normal conditions trace procedures should return NULL, indicating
  475. successful completion.
  476. If \fIproc\fR returns a non-NULL value it signifies that an
  477. error occurred.
  478. The return value must be a pointer to a static character string
  479. containing an error message.
  480. If a trace procedure returns an error, no further traces are
  481. invoked for the access and the traced access aborts with the
  482. given message.
  483. Trace procedures can use this facility to make variables
  484. read-only, for example (but note that the value of the variable
  485. will already have been modified before the trace procedure is
  486. called, so the trace procedure will have to restore the correct
  487. value).
  488. .PP
  489. The return value from \fIproc\fR is only used during read and
  490. write tracing.
  491. During unset traces, the return value is ignored and all relevant
  492. trace procedures will always be invoked.
  493.  
  494. .SH "RESTRICTIONS"
  495. .PP
  496. A trace procedure can be called at any time, even when there
  497. is a partically-formed result in the interpreter's result area.  If
  498. the trace procedure does anything that could damage this result (such
  499. as calling \fBTcl_Eval\fR) then it must save the original values of
  500. the interpreter's \fBresult\fR and \fBfreeProc\fR fields and restore
  501. them before it returns.
  502.  
  503. .SH "UNDEFINED VARIABLES"
  504. .PP
  505. It is legal to set a trace on an undefined variable.
  506. The variable will still appear to be undefined until the
  507. first time its value is set.
  508. If an undefined variable is traced and then unset, the unset will fail
  509. with an error (``no such variable''), but the trace
  510. procedure will still be invoked.
  511.  
  512. .SH "TCL_TRACE_DELETED FLAG"
  513. .PP
  514. In an unset callback to \fIproc\fR, the TCL_TRACE_DELETED bit
  515. is set in \fIflags\fR if the trace is being removed as part
  516. of the deletion.
  517. Traces on a variable are always removed whenever the variable
  518. is deleted;  the only time TCL_TRACE_DELETED isn't set is for
  519. a whole-array trace invoked when only a single element of an
  520. array is unset.
  521.  
  522. .SH "TCL_INTERP_DESTROYED"
  523. .PP
  524. When an interpreter is destroyed, unset traces are called for
  525. all of its variables.
  526. The TCL_INTERP_DESTROYED bit will be set in the \fIflags\fR
  527. argument passed to the trace procedures.
  528. Trace procedures must be extremely careful in what they do if
  529. the TCL_INTERP_DESTROYED bit is set.
  530. It is not safe for the procedures to invoke any Tcl procedures
  531. on the interpreter, since its state is partially deleted.
  532. All that trace procedures should do under these circumstances is
  533. to clean up and free their own internal data structures.
  534.  
  535. .SH BUGS
  536. .PP
  537. Tcl doesn't do any error checking to prevent trace procedures
  538. from misusing the interpreter during traces with TCL_INTERP_DESTROYED
  539. set.
  540.  
  541. .SH KEYWORDS
  542. clientData, trace, variable
  543.